<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="./a.css"/>
    <style>
        img {
            width: 340px;
            height: 500px;
        }
    </style>
</head>
<body>
<img src="https://www.vdouw.com/console/img/login1.4105f89f.jpeg"/>

<script>
    var img = document.getElementsByTagName('img')[0];
    img.onclick = function () {
        alert('你点击了图片')
    }
</script>
</body>
</html>